package pro.shushi.pamirs.apps.api.enmu;

import pro.shushi.pamirs.meta.annotation.sys.Base;
import pro.shushi.pamirs.meta.common.enmu.ExpBaseEnum;

/**
 * @author shier
 * @date 2019-08-17
 */
@Base
public enum AppsExpEnumerate implements ExpBaseEnum {

    SYSTEM_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040000, "系统异常"),
    APPS_JUDGE_EXCLUSION_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040001, "判断互斥模块失败"),
    APPS_EXCLUSION_MODULE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040002, "模块之间互斥"),
    APPS_SQL_TENANCY_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040003, "查询租户失败"),
    APPS_CHECK_VISIT_MODULE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040004, "检查租户权限进入模块异常"),
    APPS_SQL_CHECK_VISIT_MODULE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040005, "检查租户权限进入模块异常"),
    APPS_NO_MATCH_MODULE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040006, "模块匹配异常"),
    BASE_ModuleLifeCycle_INSTALL_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040007, "生命周期 install 未知异常"),
    BASE_ModuleLifeCycle_RELOAD_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040008, "生命周期 reload 未知异常"),
    BASE_ModuleLifeCycle_RELOAD_PREVIEW_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040009, "生命周期 reload preview 未知异常"),
    BASE_ModuleLifeCycle_UPGRADE_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040010, "生命周期 upgrade 未知异常"),
    BASE_ModuleLifeCycle_UPGRADE_PREVIEW_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040011, "生命周期 upgrade preview 未知异常"),
    BASE_ModuleLifeCycle_UNINSTALL_UNKNOWN_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040012, "生命周期 uninstall 未知异常"),
    BASE_MODULE_STATE_NOT_SUPPORT_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040013, "模块当前的状态不支持操作"),
    BASE_MODULE_AUTHOR_NOT_SUPPORT_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040014, "当前模块的作者为数式，不允许删除!"),
    BASE_MODULE_NOT_SELF_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040015, "当前模块非自建应用，不允许卸载"),
    BASE_LIFE_CYCLE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040016, "生命周期出错"),
    APPS_ENT_SETTING_ILLEGAL(ERROR_TYPE.SYSTEM_ERROR, 10040017, "企业设置参数异常"),
    APPS_ENT_DOMAIN_ILLEGAL(ERROR_TYPE.SYSTEM_ERROR, 10040018, "请设置域名"),
    APPS_ENT_SETTING_DOMAIN_LENGTH(ERROR_TYPE.SYSTEM_ERROR, 10040019, "长度不能少于5个字或者超过12个字"),
    APPS_ENT_SETTING_DOMAIN_EXISTED(ERROR_TYPE.SYSTEM_ERROR, 10040020, "该域名已被使用"),
    APPS_ENT_SETTING_DOMAIN_EN_NUM(ERROR_TYPE.SYSTEM_ERROR, 10040021, "仅支持小写字母和数字"),
    APPS_ENT_SETTING_DOMAIN_EN_START(ERROR_TYPE.SYSTEM_ERROR, 10040022, "必须以小写字母开头"),
    APPS_MANAGEMENT_PARAMS_ILLEGAL(ERROR_TYPE.SYSTEM_ERROR, 10040023, "参数异常"),
    APPS_MANAGEMENT_MODULE_ILLEGAL(ERROR_TYPE.SYSTEM_ERROR, 10040024, "应用编码不符合命名规则，仅支持使用数字、字母和下划线；且下划线后不能直接是数字"),
    APPS_MANAGEMENT_MODULE_NOT_EXIST(ERROR_TYPE.SYSTEM_ERROR, 10040025, "应用不存在或已删除"),
    APPS_MANAGEMENT_MODULE_ADD_ERROR_DEPENDENCY(ERROR_TYPE.SYSTEM_ERROR, 10040026, "操作失败,依赖的模块未安装,{}"),
    APPS_MANAGEMENT_MODULE_SUB_DEPENDENCY(ERROR_TYPE.SYSTEM_ERROR, 10040027, "更新应用失败,暂不支持去除依赖"),
    APPS_MANAGEMENT_MODULE_INSTALL_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040028, "安装应用失败"),
    APPS_MANAGEMENT_MODULE_UNINSTALL_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040029, "卸载应用失败"),
    APPS_MANAGEMENT_PARAMS_ILLEGAL_NOCODE(ERROR_TYPE.SYSTEM_ERROR, 10040030, "该操作当前仅支持无代码模块"),
    APPS_MANAGEMENT_PARAMS_ILLEGAL_MENU_UNBINDING_VIEW(ERROR_TYPE.SYSTEM_ERROR, 10040031, "菜单未绑定页面"),
    APPS_MANAGEMENT_MODULE_INSTALL_APP_STATUS_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040032, "安装应用失败:应用状态异常"),
    APPS_MANAGEMENT_MODULE_INSTALL_MODULE(ERROR_TYPE.SYSTEM_ERROR, 10040033, "安装应用失败:依赖的应用「{}」未安装"),
    APPS_MANAGEMENT_MODULE_UNINSTALL_APP_UNINSTALL(ERROR_TYPE.SYSTEM_ERROR, 10040034, "卸载应用失败:应用未安装"),
    APPS_MANAGEMENT_MODULE_UNINSTALL_HAS_DEPENDENCY(ERROR_TYPE.SYSTEM_ERROR, 10040035, "卸载应用失败：该应用被「{}」依赖"),
    APPS_DATA_MOCK_NODE_MODULE_ERROR(ERROR_TYPE.SYSTEM_ERROR, 10040036, "卸载应用失败：该应用被「{}」依赖"),
    APPS_DEPENDENCY_MODULE_NOT_EXIST(ERROR_TYPE.BIZ_ERROR, 10040037, "依赖模块不存在"),
    APPS_DEPENDENCY_MODULE_EXIST_CIRCULAR_DEPENDENCY(ERROR_TYPE.BIZ_ERROR, 10040038, "依赖模块存在循环依赖 {}"),
    APPS_UPSTREAM_MODULE_NOT_EXIST_DEPENDENCY(ERROR_TYPE.BIZ_ERROR, 10040039, "上游模块必须在依赖模块中"),
    APPS_NOCODE_MODULE_NOT_SUPPORT(ERROR_TYPE.BIZ_ERROR, 10040040, "暂不支持该版本");

    private final ERROR_TYPE type;

    private final int code;

    private final String msg;

    AppsExpEnumerate(ERROR_TYPE type, int code, String msg) {
        this.type = type;
        this.code = code;
        this.msg = msg;
    }

    @Override
    public ERROR_TYPE type() {
        return type;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }
}
